<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
	$id= $_POST['biobitid'];
	$namev= $_REQUEST['bb'];
	$descv= $_REQUEST['desc'];
	$linkv= $_REQUEST['link'];
	
	if($id==""){$id=1;}
}else{

	$id=1;
}


$errores=$_SESSION["biobitForm"]["errores"];
if(isset($errores)){ 
	if(isset($errores[name])){
		$errorname=$errores[name];
	}
	if(isset($errores[desc])){
		$errordesc=$errores[desc];

	}
	if(isset($errores[link])){
		$errorlink=$errores[link];

	}
}else{
	$errorname="";
	$errordesc="";
	$errorlink="";
}
//VER SI PONEMOS EL ERROR EN EL SPAN
?>


<div id="newBiobitForm<?php echo $id;?>">
<fieldset>
<legend>Add new BioBit</legend>
<form onsubmit="return val_bb(<?php echo $id;?>)" action='val_bb.php?id=<?php echo $id;?>' method="post">


<div id="div_biobit_name<?php echo $id;?>"><label
	id="label_biobit_name<?php echo $id;?>"
	for="biobit_name<?php echo $id;?>">Name:</label> <input
	id="biobit_name<?php echo $id;?>" name="biobit_name<?php echo $id;?>"
	class="<?php if($errorname){
	echo "errorForm";
	}?>" type="text"
	value="<?php if(isset($namev)){ echo $namev; }?>" /> 
	<?php 
	if($errorname){
		?>
		<span id="span_biobit_name<?php echo $id;?>"  class="errorForm";><?php echo $errorname;?></span>
        <?php
	}else{
		?>
		<span id="span_biobit_name<?php echo $id;?>">What's BioBit name?</span>
        <?php	
	}
	?>
</div>
		
	
<div id="div_desc<?php echo $id;?>"><label
	id="label_biobit_desc<?php echo $id;?>"
	for="biobit_desc<?php echo $id;?>">Description:</label> <input
	id="biobit_desc<?php echo $id;?>" name="biobit_desc<?php echo $id;?>"
	type="text" class="<?php if($errordesc){
	echo "errorForm";
	}?>" type="text"
	value="<?php if(isset($descv)){ echo $descv; }?>" /> 
	<?php 
	if($errordesc){
		?>
		<span id="span_biobit_desc<?php echo $id;?>"  class="errorForm";><?php echo $errordesc;?></span>
        <?php
	}else{
		?>
		<span id="span_biobit_desc<?php echo $id;?>">Description</span>
        <?php	
	}
	?>
</div>
	

<div id="div_biobit_link<?php echo $id;?>"><label
	id="label_biobit_link<?php echo $id;?>"
	for="biobit_link<?php echo $id;?>">BioBit link:</label> <input
	id="biobit_link<?php echo $id;?>" name="biobit_link<?php echo $id;?>"
	class="<?php if($errorlink){
	echo "errorForm";
	}?>" type="text"
	value="<?php if(isset($linkv)){ echo $linkv; }?>" /> 
	
	<?php 
	if($errorlink){
		?>
		<span id="span_biobit_link<?php echo $id;?>"  class="errorForm";><?php echo $errorlink;?></span>
        <?php
	}else{
		?>
		<span id="span_biobit_link<?php echo $id;?>">DB Link</span>
        <?php	
	}
	?>
	
</div>



<div class="botonMolon" id="div_submitnewBiobit<?php echo $id;?>">
<button id="submitnewBiobit<?php echo $id;?>">Send</button>
</div>
</form>
</fieldset>

</div>

